Type Analysis for JavaScript

نویسندگان

  • Simon Holm Jensen
  • Anders Møller
  • Peter Thiemann
چکیده

JavaScript is the main scripting language for Web browsers, and it is essential to modernWeb applications. Programmers have started using it for writing complex applications, but there is still little tool support available during development. We present a static program analysis infrastructure that can infer detailed and sound type information for JavaScript programs using abstract interpretation. The analysis is designed to support the full language as defined in the ECMAScript standard, including its peculiar object model and all built-in functions. The analysis results can be used to detect common programming errors – or rather, prove their absence, and for producing type information for program comprehension. Preliminary experiments conducted on real-life JavaScript code indicate that the approach is promising regarding analysis precision on small and medium size programs, which constitute the majority of JavaScript applications. With potential for further improvement, we propose the analysis as a foundation for building tools that can aid JavaScript programmers.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Improving Tools for JavaScript Programmers

We present an overview of three research projects that all aim to provide better tools for JavaScript web application programmers: TAJS, which infers static type information for JavaScript applications using dataflow analysis; JSRefactor, which enables sound code refactorings; and Artemis, which provides high-coverage automated testing. 1. JAVASCRIPT PROGRAMMERS NEED

متن کامل

JSAI: Designing a Sound, Configurable, and Efficient Static Analyzer for JavaScript

We describe JSAI, an abstract interpreter for JavaScript. JSAI uses novel abstract domains to compute a reduced product of type inference, pointer analysis, string analysis, integer and boolean constant propagation, and control-flow analysis. In addition, JSAI allows for analysis control-flow sensitivity (i.e., context-, path-, and heap-sensitivity) to be modularly configured without requiring ...

متن کامل

RATA: Rapid Atomic Type Analysis by Abstract Interpretation - Application to JavaScript Optimization

We introduce RATA, a static analysis based on abstract interpretation for the rapid inference of atomic types in JavaScript programs. RATA enables aggressive type specialization optimizations in dynamic languages. RATA is a combination of an interval analysis (to determine the range of variables), a kind analysis (to determine if a variable may assume fractional values, or NaN), and a variation...

متن کامل

Interprocedural Type Specialization of JavaScript Programs Without Type Analysis

Previous work proposed lazy basic block versioning, a technique for just-in-time compilation of dynamic languages which we believe represents an interesting point in the design space. Basic block versioning is simple to implement, simple enough that a single developer can build a complete just-in-time compiler for JavaScript in a year, yet it performs surprisingly well as it propagates context-...

متن کامل

Type Safety for JavaScript

JavaScript is a client-side scripting language for the web and has become increasingly popular with the introduction of AJAX. JavaScript is a dynamic-typed language and is closer to a functional language than a procedural language. Runtime errors can occur in JavaScript due to invalid type conversions and accesses to undefined members of objects. One solution is the use of type systems to valid...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2009